﻿@using GoodMan.Infrastructure.Entities.Entity;
@using GoodMan.Tool.Configration;
@using GoodMan.Portal.Biz;
@using GoodMan.Tool.Framework;
@{
    int cartCount = 0;
    if (System.Web.HttpContext.Current.Request.Cookies["ShoppingCart"] == null)
    {
        //Do nothing
    }
    else
    {
        HttpCookie oCookie = (HttpCookie)System.Web.HttpContext.Current.Request.Cookies["ShoppingCart"];
        // oCookie.Expires = DateTime.Now.AddHours(3);
        string tempCart = System.Web.HttpUtility.UrlDecode(oCookie.Value, System.Text.Encoding.GetEncoding("UTF-8")).ToString();
        var tempList = new List<OrderDetail>();
        tempList = GoodMan.Tool.Framework.TypePlug.ToObject<List<OrderDetail>>(tempCart);
        if (tempList != null && tempList.Count > 0)
        {
            cartCount = tempList.Count();
        }
    }
    List<Notice> notices = iCache.Get("SupportBiz.GetNewNotice_0_10", () => SupportBiz.GetNewNotice(0, 10), 600);
    var leftad = SiteResource.Block.FirstOrDefault(c => c.Key == "5");
}
<!DOCTYPE html>
<html>
<head>
    <title>@ViewBag.Title</title>
    <meta http-equiv="content-type" content="text/html;charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta content="@ViewBag.Keywords" name="keywords"/>
    <meta name="description" content="@ViewBag.Description" />
    <link rel="stylesheet" href="/content/css/bootstrap.min.css" />
    <script type="text/javascript" src="/scripts/jquery.js"></script>
    <script type="text/javascript" src="/scripts/bootstrap.min.js"></script>
    <script type="text/javascript">
        function ClearShoppingCart() {
            $.post("/Shop/ClearShoppingCart", null, function (response) {
                $("#cart").html(response.split('^')[0]);
                $("#shoppingcartitem").html(response.split('^')[1]);
            });
            return false;
        }
        function DelShoppingCart(id, verValue) {
            $.post("/Shop/RemoveShoppingCart", { ProductID: id, verValue: verValue }, function (response) {
                $("#cart").html(response.split('^')[0]);
                $("#shoppingcartitem").html(response.split('^')[1]);
            });
            return false;
        }

        var r = /^[0-9]*[1-9][0-9]*$/;
        function changeCartNum(id, price, pid) {
            //alert(id + price);
            var num = $("#numcart" + id).val();
            if (!r.test(num)) {
                $("#numcart" + id).val("1");
                num = 1;
                alert("请输入大于等于1的正整数");

            }

            var money = num * price;
            $("#moneycart" + id).html(ffmoney(money, 2));
            var totalMoney = 0;
            var ids = $("#ids").val().split(',');
            for (var i = 0; i < ids.length; i++) {
                if (ids[i] != "") {
                    var temp = $("#moneycart" + ids[i]).html();
                    totalMoney = totalMoney + temp * 1;
                }
            }
            //alert(totalMoney);
            $("#totalmoneycart").html(ffmoney(totalMoney, 2));
            // $("#totalmoney").val(ffmoney(totalMoney, 2));
            var verValue = $("#vercart" + id).val();

            $.post("/Shop/ChangeProductNum", { prodductid: pid, verValue: verValue, num: num }, function (response) {
                //$("#cart").html(response);
            });
            return false;
        }

        function ffmoney(s, n) {
            n = n > 0 && n <= 20 ? n : 2;
            s = parseFloat((s + "").replace(/[^\d\.-]/g, "")).toFixed(n) + "";
            var l = s.split(".")[0].split("").reverse();
            var r = s.split(".")[1];
            var t = "";
            for (i = 0; i < l.length; i++) {
                t += l[i] + "";
            } return t.split("").reverse().join("") + "." + r;

        }
        
    </script>
    @RenderSection("head", false)
    <style type="text/css">
        body
        {
            overflow-x: hidden;
        }
        #style-switcher
        {
            position: absolute;
            width: 180px;
            height: 580px;
            background-color: #eee;
            z-index: 10;
            right: 0;
            top: 130px;
            border-radius: 5px 0 0 5px;
            margin-right: -180px;
        }
        #style-switcher i
        {
            display: inline-block;
            margin: 5px 10px 0 10px;
            cursor: pointer;
        }
    </style>
    <link rel="stylesheet" href="/content/css/style.css" />
</head>
<body>
    <div class="container ad-container">
        <!--/////////////////////////-->
        <div class="side-ad-left">
        @if (String.IsNullOrEmpty(leftad.Items[0].href))
        { 
            <a target="_blank">
                <img alt="ad" style="width:200px; height:310px;" src="@leftad.Items[0].img"/>
            </a>
        }
        else
        { 
            <a href="@leftad.Items[0].href" target="_blank">
                <img alt="ad" style="width:200px; height:310px;" src="@leftad.Items[0].img"/>
            </a>
        }
            <a href="javascript:;" class="ad-close">关闭</a>
        </div>
        <div class="side-ad-right">
        @if (String.IsNullOrEmpty(leftad.Items[1].href))
        { 
            <a target="_blank">
                <img alt="ad" style="width:200px; height:310px;" src="@leftad.Items[1].img"/>
            </a>
        }
        else
        { 
            <a href="@leftad.Items[1].href" target="_blank">
                <img alt="ad" style="width:200px; height:310px;" src="@leftad.Items[1].img"/>
            </a>
        }
            <a href="javascript:;" class="ad-close">关闭</a>
        </div>
        <!--/////////////////////////-->
    </div>
    <!--用户导航-->
    <!--<a name="top"></a>-->
    <div class="container-fluid bg-gray border-bottom-gray">
        <div class="container shortcut-banner text-center">
            <div class="row">
                <div class="span4 pull-left text-left">
                    享受属于您的快捷！
                        @{
                            var host = SiteResource.Url;
                            var siteInfo = SiteResource.DomainScope[host];
                            if (siteInfo != null)
                            {
                                <div class="btn-group">
                                  <button class="btn btn-mini">@siteInfo</button>
                                  <button class="btn btn-mini dropdown-toggle" data-toggle="dropdown">
                                    <span class="caret"></span>
                                  </button>
                                  <ul class="dropdown-menu">
                                    @foreach (var item in SiteResource.DomainScope)
                                    {
                                        if (item.Key != host)
                                        {
                                            string url = "http://" + item.Key;
                                             <li><a href="@url">@item.Value</a></li>
                                        }
                                    }
                                  </ul>
                                </div>
                            }
                            }
                    </div>
                <div class="span8 pull-right text-right">
                    @Html.Partial("/views/shared/partials/_userstate.cshtml")
                    <a href="/usercenter/order"><span class="icon-list"></span>&nbsp;我的订单</a> <a href="javascript:;"
                        onclick="openshoppingcart()"><span class="icon-shopping-cart"></span>&nbsp;购物车(<span
                            class="text-error"><strong id="shoppingcartitem">@cartCount</strong></span>)</a>
                    <a href="javascript:;" id="btncs"><span class="icon-user"></span>&nbsp;在线客服</a>
                </div>
            </div>
        </div>
    </div>
    <!--#用户导航-->
    <!--顶部banner-->
    <div class="container banner-top">
        <div class="row">
            <div class="span2">
                <a href="/"><div class="logo">
                    <!--logo大小为:220x90-->
                </div></a>
            </div>
            <div class="span8 pull-right text-right">
                @{SiteResource.BlockGroup group = SiteResource.Block.FirstOrDefault(c => c.Key == "6");}
                @if (group != null && group.Items != null && group.Items.Any())
                {
                    if (String.IsNullOrEmpty(group.Items[0].href))
                    {
                    <a>
                        <img alt="@(group.Items[0].alt)" style="height:85px; padding-top:2px;" src="@(group.Items[0].img)" />
                    </a>
                    }
                    else
                    { 
                    <a target="_blank" href="@(group.Items[0].href)">
                        <img alt="@(group.Items[0].alt)" style="height:85px; padding-top:2px;" src="@(group.Items[0].img)" />
                    </a>
                    }
                }
            </div>
        </div>
    </div>
    @if (notices != null && notices.Any())
    {
        <div class="container" style="border-top: 1px solid #ccc;">
            <div id="rollblack" style="background-color: #F7F7F9; height: 30px; font-size: 15px;
                overflow: hidden;">
                <div style="height: 150px;">
                    @foreach (var item in notices)
                    {
                        <div class="row" style="line-height: 30px;">
                            <a target="_blank" href="/home/noticedetail/@item.Id">
                                <div class="span10">
                                    公告： @item.Title.PieceOfString(0, 30, "...") (@item.CreateTime.ToString("yyyy-MM-dd"))</div>
                            </a>
                        </div>
                    }
                </div>
            </div>
        </div>
    }
    <!--#顶部banner-->
    <!--主菜单-->
    <div class="container-fluid nav-menu">
        <div id="menu" class="container">
            <div class="row">
                <div class="span3 menu-left">
                    <div class="menu">
                        <a href="/" style="width: 180px; text-align: left;"><i class="icon icon-home icon-white icon-large">
                        </i>&nbsp;&nbsp;首页</a>
                    </div>
                </div>
                <div class="span9 menu-right">
                    <div class="menu">
                        <li><a href="/">校园商城</a>
                            <div class="menu-sub">
                                <ul>
                                    <li><a id="special" href="/shop/PrductArea?code=general&type=3">限时特卖</a></li>
                                    <li><a id="remmended" href="/shop/PrductArea?code=general&type=2">特别推荐</a></li>
                                    <li><a id="groupbuy" href="/shop/PrductArea?code=groupbuy">校园团购</a></li>
                                    <li><a id="exchange" href="/shop/PrductArea?code=exchange">积分商城</a></li>
                                    <li><a href="/shop/packagesProducts">实惠套餐</a></li>
                                </ul>
                            </div>
                        </li>
                        <li><a href="/shop/FastFood">快餐外卖</a></li>
                        <li><a href="/home/pubinfolist">招聘信息</a></li>
                    </div>  
                    <div style="display:none;"><a href="http://apycom.com/">jQuery Menu by Apycom</a></div>
                </div>
            </div>
        </div>
    </div>
    <div class="container">
        @RenderBody()
    </div>
    <div class="container-fluid bg-gray">
        <div class="container">
            <div class="footer">
                <div class="f-block fb-border-crimson" style="height:0px;">
                    @{
                        SiteResource.ArticleGroup delivery = SiteResource.SiteArticles.Delivery;
                    }
                    <div class="fb-title">
                        @*@delivery.Title*@</div>
                    @* <p>
                        @foreach (var item in delivery.Items)
                        { 
                            <a href="/home/detail/@item.Id" class="v-list">@item.Title</a>
                        }</p>*@
                </div>
                <div class="f-block fb-border-brown" style="height:0px;">
                    @{
                        SiteResource.ArticleGroup shoppingGuide = SiteResource.SiteArticles.ShoppingGuide;
                    }
                    <div class="fb-title">
                        @*@shoppingGuide.Title*@</div>
                    @*<p>
                        @foreach (var item in shoppingGuide.Items)
                        { 
                            <a href="/home/detail/@item.Id" class="v-list">@item.Title</a>
                        }</p>*@
                </div>
                <div class="f-block fb-border-rosybrown" style="height:0px;">
                    @{
                        SiteResource.ArticleGroup cooperation = SiteResource.SiteArticles.Cooperation;
                    }
                    <div class="fb-title">
                        @*@cooperation.Title*@</div>
                    @*<p>
                        @foreach (var item in cooperation.Items)
                        { 
                            <a href="/home/detail/@item.Id" class="v-list">@item.Title</a>
                        }</p>*@
                </div>
                <div class="f-block fb-border-darksalmon" style="height:0px;">
                    @{
                        SiteResource.ArticleGroup aboutUs = SiteResource.SiteArticles.AboutUs;
                    }
                    <div class="fb-title">
                        @*@aboutUs.Title*@</div>
                    @*<p>
                        @foreach (var item in aboutUs.Items)
                        { 
                            <a href="/home/detail/@item.Id" class="v-list">@item.Title</a>
                        }</p>*@
                </div>
            </div>
            <div class="clearfix">
            </div>
            <hr />
            <div class="copyright text-center">
                @SiteResource.CompanyName 版权所有 &copy; Copyright 2013 <a href="http://www.miitbeian.gov.cn" target="_blank">蜀ICP备13020635</a></div>
        </div>
    </div>
    <div id="style-switcher">
        <i class="icon-arrow-left
    icon-black"></i>
        <div style="display: inline;">
            在线客服:</div>
        <hr style="margin: 0px" />
        <br />
        <div class="row-fluid">
            <div class="span12">
                请选择客服进行咨询：</div>
            <div class="span12">
                快餐商户客服 : <a target="_blank" href="http://wpa.qq.com/msgrd?v=3&amp;uin=@SiteResource.BussnissQQ&amp;site=qq&amp;menu=yes">
                    <img border="0" src="http://wpa.qq.com/pa?p=2:@SiteResource.BussnissQQ:41" alt="点击这里给我发消息"
                        title="点击这里给我发消息" />
                </a>
            </div>
            <div class="span12">
                信息平台客服 :<a target="_blank" href="http://wpa.qq.com/msgrd?v=3&amp;uin=@SiteResource.InfoQQ&amp;site=qq&amp;menu=yes">
                    <img border="0" src="http://wpa.qq.com/pa?p=2:@SiteResource.InfoQQ:41" alt="点击这里给我发消息"
                        title="点击这里给我发消息" />
                </a>
            </div>
            @{
                Dictionary<Dormitory, User> duty = GoodMan.Portal.Biz.SupportBiz.GetCurrentOnDuty();
                if (duty != null && duty.Any())
                {
                    foreach (var item in duty)
                    {
                <div class="span12">
                    @item.Key.Name : <a target="_blank" href="http://wpa.qq.com/msgrd?v=3&amp;uin=@item.Value.QQ&amp;site=qq&amp;menu=yes">
                        <img border="0" src="http://wpa.qq.com/pa?p=2:@item.Value.QQ:41" alt="点击这里给我发消息"
        title="点击这里给我发消息" />
                    </a>
                </div>
                    }
                }
            }
        </div>
    </div>
    <div id="shoppingcartframe" style="display: none; height: 500px;" class="span10">
        <div class="span10 text-right">
            <a id="btncloseframe" href="javascript:;" style="margin-right: 30px;">
                <img alt="close" src="/Content/img/closelabel.gif" /></a>
        </div>
        <div id="cart">
        </div>
        <!--#购物车-->
    </div>
    <input type="button" id="btngetCart" onclick="getCart()" style="display: none" />
    @Html.Partial("/views/shared/partials/_notify.cshtml")
    <!--<a id="scrollUp" href="#top" title="" style="position: fixed; z-index: 2147483647;"></a>-->
    <script type="text/javascript" src="/scripts/plug.js"></script>
    <script type="text/javascript" src="/scripts/menu.js"></script>
    <script type="text/javascript">
        function doscroll() {
            return window.setInterval(function () {
                $('#rollblack').children('div').animate({ 'margin-top': '-30px' }, 1500, 'swing', function () {
                    var first = $(this).children('div:eq(0)');
                    $(this).children('div:eq(0)').remove();
                    $(this).append(first);
                    $(this).css({ 'margin-top': '0px' });
                });
            }, 5000);
        }
        $(function () {
            $('.menu li').hover(function (e) {
                $(this).find('.menu-sub').show();
            });
            $('.menu-sub li').mouseout(function (e) {
                $(this).find('.menu-sub').hide();
            });
            var interval = doscroll();
            $('.ad-close').click(function () {
                $(this).parent().slideUp('fase');
            });
            $('#style-switcher i').click(function () {
                if ($(this).hasClass('open')) {
                    $(this).parent().animate({ marginRight: '-=180' });
                    $(this).removeClass('open');
                }
                else {
                    $(this).parent().animate({ marginRight: '+=180' });
                    $(this).addClass('open');
                }
                $(this).toggleClass('icon-arrow-left');
                $(this).toggleClass('icon-arrow-right');
            });
            $('#style-switcher a').click(function () {
                var style = $(this).attr('href').replace('#', '');
                $('.skin-color').attr('href', 'css/unicorn.' + style + '.css');
                $(this).siblings('a').css({ 'border-color': 'transparent' });
                $(this).css({ 'border-color': '#aaaaaa' });
            });
            $('#btncs').click(function () {
                $('#style-switcher i').trigger('click');
            });
        });
        function openshoppingcart() {
            $.post("/Shop/GetShoppingCart", null, function (response) {
                //alert(response);
                $("#cart").html(response.split('^')[0]);
                $("#shoppingcartitem").html(response.split('^')[1]);
            });
            new plug.PopFrame().OpenFrame('shoppingcartframe', 'btncloseframe');
        }
        function checkcount(sender) {
            if (!/^\d+$/.test($(sender).val())) {
                $(sender).val(1);
            }
        } 
    </script>
    @RenderSection("tail", false)
</body>
</html>
